﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace CS795.TravelAgency.Domain.Entities.Configurations
{
    public class FlightReservationConfiguration : EntityTypeConfiguration<FlightReservation>
    {
        public FlightReservationConfiguration()
        {
            HasKey(p => p.Id);
            HasRequired(p => p.Trip).WithMany().HasForeignKey(p => p.TripId).WillCascadeOnDelete(true);
            HasRequired(p => p.Vendor).WithMany().HasForeignKey(p => p.VendorId).WillCascadeOnDelete(true);
            Property(p => p.Status).IsRequired();
            Property(p => p.QuoteId).IsRequired();
            Property(p => p.PricePerSeat).HasPrecision(18, 2).IsRequired();
            Property(p => p.TotalPrice).HasPrecision(18, 2).IsRequired();
            Property(p => p.ReservationId).IsOptional();
            Property(p => p.SeatType).IsRequired();
            Property(p => p.Count).IsRequired();
            Property(p => p.Departure).HasMaxLength(50).IsRequired();
            Property(p => p.Destination).HasMaxLength(50).IsRequired();
            Property(p => p.Date).IsRequired();
        }
    }
}
